/**
 * @file {同步tft_pol 精度检测工位数据}
 */
 'use strict'

 const PolBase = require('./base');
 
 class SynchronizeTftPol  extends PolBase {
 
     constructor (tableModel,sequelize_source, sequelize_aim, stationName, mujian) {
         super(tableModel, sequelize_source, sequelize_aim, stationName, mujian);
     }
     /**
      * 初始化参数
      * @param {Object} 各个表的模型
      * @param {Sequeliz} sequelize_source 源表的sequelize实例
      * @param {Sequeliz} sequelize_aim 目标表的sequelize实例
      * @param {string} stationName 工站名（便于日志区分）
      * @returns
      */
     static getInstance (tableModel, sequelize_source, sequelize_aim, stationName, mujian) {
         return SynchronizeTftPol.instance ?  SynchronizeTftPol.instance : new SynchronizeTftPol(tableModel, sequelize_source, sequelize_aim, stationName, mujian);
     }
     /**
     * 根据panel获取全部信息
     * @param {String} panel_id
     */
    async getNewstInfoByPanelId (panel_id) {
        let panel_info = await this.handPanelInfo(panel_id);
        let job_info = await this.handJobInfo(panel_id);
        let flaw_info = await this.handFlawInfo(panel_id);
        let flaw_filter_info = await this.handFlawFilterInfo(panel_id);
        let stations = flaw_filter_info.map((item) => {
            return {
                station_id:item.station_id,
                station_name:item.station_name
            }
        })
        return {
            panel_info,
            job_info,
            flaw_info,
            flaw_filter_info,
            stations
        }
    }
 }
 
 module.exports = SynchronizeTftPol;